# Makefile for csie-compiler
# Author: b96902133, Hakki Caner KIRMIZI
# Date: 20100613

# flex scanner.l --> creates: lex.yy.c
# bison -v parser.y --> creates: parser.output parser.tab.c
# gcc parser.tab.c -ly -ll -lm --> generates executable parser

LEX=flex
YACC=bison
PROG=parser
SCNR=scanner
CC=gcc
SRCS=$(PROG).y $(SCNR).l
GEN=gen_code.h
LIBS=lib/hashtable.o lib/hashtable_itr.o
FLAGS=-g -O -lm
YFLAGS=-ly -ll -lfl

all: $(PROG)

$(PROG): $(SRCS)
	$(LEX) $(SCNR).l
	$(YACC) -dv $(PROG).y
	$(CC) $(FLAGS) -o $(PROG) $(PROG).tab.c $(YFLAGS) $(LIBS)

clean:
	rm -rf $(PROG) lex.yy.c $(PROG).tab.h $(PROG).tab.c $(PROG).output *.o Program.bass
